Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC of "additional layer store" of Podman/CRI-O and lazy pulling of zstd:chunked #281

Closed
wants to merge 2 commits into from

Conversation

ktock
Copy link
Member

@ktock ktock commented Mar 5, 2021

This PR contains the following:

  • PoC of "additional layer store" of Podman/CRI-O
  • PoC of lazy pulling of zstd:chunked

Zstd:chunked is a variant of zstd that enables extracting each file separately. The structure based on stargz and its verification logic is based on eStargz. Currently, this is enabled by directly patching estargz lib for supporting that compression algorithm (zstd) and that footer format. Maybe we should make estargz lib configurable against compression algorithms and separate zstd:chunked patches into an indipendent package.

"Additional layer store" is a proposed functionality for https://github.com/containers/storage to provide remotely mounted layers to the runtime. Currently, this is implemented as a thin wrapper of our fs package. Instead of implementing snapshotter API, this directly exposes layers on the filesystem. This seems a bit out of scope as a non-core subproject of containerd. So this should be separated to another project, maybe?

The following command mounts the store at the <mountpoint>:

# registry-storage <mountpoint>

This store exposes the following structure required as an additional layer store:

<mountpoint>/base64(imageref)/<layerdigest>/
- layer : exposes the extracted layer
- info  : contains JSON-formatted "Layer" structure of containers/storage
- use   : files to notify the use of this layer (used for management of reference count)

There are also other APIs for debugging:

<mountpoint>/base64(imageref)/
- manifest       : contains manifest of this image
- config         : contains config blob of this image
- <layerdigest>/
  - chain        : exposes the extracted chain from the bottommost to this layer

HelloBench result of Podman + {eStargz, zstd:chunked} on GitHub Actions (Standard_DS2_v2 instance at eastus2):

https://github.com/ktock/stargz-snapshotter/actions/runs/623653929

I'll work on experiment on a richer instance with larger number of samples.

result

@ktock
Copy link
Member Author

ktock commented Mar 5, 2021

cc @giuseppe @AkihiroSuda

@@ -66,6 +67,11 @@ When '--all-platforms' is given all images in a manifest list must be available.
Usage: "eStargz chunk size",
Value: 0,
},
// zstd:chunked flags
cli.BoolFlag{
Name: "zstdchunked",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: zstdchunked -> zstd-chunked (just my preference)


const (
defaultLogLevel = logrus.InfoLevel
defaultRootDir = "/var/lib/registry-storage"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be something like /var/lib/stargz-registry-storage?

@AkihiroSuda
Copy link
Member

AkihiroSuda commented Mar 5, 2021

# registry-storage <mountpoint>

Shouldn't the exec name be like stargz-registry-storage to avoid conflict with other storage impls?

ktock added a commit to ktock/stargz-snapshotter that referenced this pull request Mar 26, 2021
…zstd:chunked)

This is the subset of containerd#281.

Initially, eStargz is based on gzip compression. But, through zstd:chunked work,
it turned out that eStargz is not limited to gzip compression and the same
chunking & verifying & prefetching method can be applied to other compression
algorithms as well (e.g. zstd).

This commit makes `estargz` pkg configurable and agnostic about compression
algorithms. For supporting non-gzip compression, the user must implement
`estargz.Decompressor` and `estargz.Compressor` interfaces and must plug them to
`estargz` tools (e.g. `estargz.Open` and
`estargz.NewWriterWithCompression`). `estargz` also provides test suite that is
usable for testing these non-gzip eStargz implementations.

This commit comes with `zstdchunked` pkg that support zstd compression for
eStargz (a.k.a. zstd:chunked), based on the above extensibility. `zstdchunked`
pkg contains `zstdchunked.Decompressor` and `zstdchunked.Compressor` that allows
`estargz` pkg to use zstd compression (i.e. zstd:chunked) instead of gzip.

Layer converter and filesystem now support zstd:chunked leveraging `zstdchunked`
pkg. `ctr-remote image optimize` and `ctr-remote image convert` support
`--zstdchunked` option that omits zstd-based eStargz and filesystem supports
zstd-based eStargz layers by default.

Signed-off-by: Kohei Tokunaga <[email protected]>
ktock added a commit to ktock/stargz-snapshotter that referenced this pull request Mar 26, 2021
…zstd:chunked)

This is the subset of containerd#281.

Initially, eStargz is based on gzip compression. But, through zstd:chunked work,
it turned out that eStargz is not limited to gzip compression and the same
chunking & verifying & prefetching method can be applied to other compression
algorithms as well (e.g. zstd).

This commit makes `estargz` pkg configurable and agnostic about compression
algorithms. For supporting non-gzip compression, the user must implement
`estargz.Decompressor` and `estargz.Compressor` interfaces and must plug them to
`estargz` tools (e.g. `estargz.Open` and
`estargz.NewWriterWithCompression`). `estargz` also provides test suite that is
usable for testing these non-gzip eStargz implementations.

This commit comes with `zstdchunked` pkg that support zstd compression for
eStargz (a.k.a. zstd:chunked), based on the above extensibility. `zstdchunked`
pkg contains `zstdchunked.Decompressor` and `zstdchunked.Compressor` that allows
`estargz` pkg to use zstd compression (i.e. zstd:chunked) instead of gzip.

Layer converter and filesystem now support zstd:chunked leveraging `zstdchunked`
pkg. `ctr-remote image optimize` and `ctr-remote image convert` support
`--zstdchunked` option that omits zstd-based eStargz and filesystem supports
zstd-based eStargz layers by default.

Signed-off-by: Kohei Tokunaga <[email protected]>
ktock added a commit to ktock/stargz-snapshotter that referenced this pull request Mar 26, 2021
…zstd:chunked)

This is the subset of containerd#281.

Initially, eStargz is based on gzip compression. But, through zstd:chunked work,
it turned out that eStargz is not limited to gzip compression and the same
chunking & verifying & prefetching method can be applied to other compression
algorithms as well (e.g. zstd).

This commit makes `estargz` pkg configurable and agnostic about compression
algorithms. For supporting non-gzip compression, the user must implement
`estargz.Decompressor` and `estargz.Compressor` interfaces and must plug them to
`estargz` tools (e.g. `estargz.Open` and
`estargz.NewWriterWithCompression`). `estargz` also provides test suite that is
usable for testing these non-gzip eStargz implementations.

This commit comes with `zstdchunked` pkg that support zstd compression for
eStargz (a.k.a. zstd:chunked), based on the above extensibility. `zstdchunked`
pkg contains `zstdchunked.Decompressor` and `zstdchunked.Compressor` that allows
`estargz` pkg to use zstd compression (i.e. zstd:chunked) instead of gzip.

Layer converter and filesystem now support zstd:chunked leveraging `zstdchunked`
pkg. `ctr-remote image optimize` and `ctr-remote image convert` support
`--zstdchunked` option that omits zstd-based eStargz and filesystem supports
zstd-based eStargz layers by default.

Signed-off-by: Kohei Tokunaga <[email protected]>
@ktock ktock mentioned this pull request Apr 12, 2021
1 task
@ktock
Copy link
Member Author

ktock commented Apr 12, 2021

Closing in favor of #293 and #301.

@ktock ktock closed this Apr 12, 2021
@ktock ktock deleted the als-pool-example branch September 3, 2021 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants